<template>
  <a-select
    show-search
    option-filter-prop="children"
    :placeholder="$t('fwgsy')"
    :allow-clear="true"
    :mode="mode"
    :maxTagCount="maxTagCount"
    :value="defaultValue"
    :disabled="disabled"
    style="width:100%"
    @change="changeoption"
  >
    <a-select-option v-for="item in options" :key="item.value" :value="item.value">
      {{ item.name }}
    </a-select-option>
  </a-select>
</template>
<script>
import { mapState } from 'vuex'
export default {
  props: {
    defaultValue: {
      type: [String, Array, Number, undefined, Object],
      default () {
        return undefined
      }
    },
    mode: {
      type: String,
      default: 'default'
    },
    disabled: {
      type: Boolean,
      default: false
    },
    maxTagCount: {
      type: Number,
      default: 1
    }
  },
  computed: {
    ...mapState({
      options: (state) => state.dict.serviceSaleBelongFlagDictCode
    })
  },
  data () {
    return {

    }
  },
  created () {
    this.$store.dispatch('getServiceSaleBelongFlagDictCodeData')
  },
  methods: {
    changeoption (val) {
      this.$emit('changeoption', val)
    }
  }
}
</script>
